<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
	<meta charset="UTF-8">
	<title>校友活动-查看详细</title>
	<link rel="stylesheet" href="/css/bootstrap.min.css">
	<link rel="stylesheet" href="/css/index.css">
	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<link href="/css/materialdesignicons.min.css" rel="stylesheet">
	<link href="/css/style.min.css" rel="stylesheet">
	<script src="/js/jquery.min.js"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="/js/bootstrap.min.js"></script>
</head>
<body class="body">
<div th:insert="~{navigation :: copy}"></div>
<div class="container">
	<h2 th:text="${act.acTitle}"></h2>
	<hr>
	<div class="row">
		<!--<form  action='/news/getAllNews' id="form3" method='post' role="form">
			<input type="hidden" name="page" id="pageNo" th:value="${page}">
		</form>-->
		<div  class="col-lg-8">
			<dl class="row">
				<dt class="col-sm-3"><span>具体描述：</span></dt>
				<dd class="col-sm-9"><span th:text="${act.acDesc}"></span></dd>
			</dl>
			<dl class="row">
				<dt class="col-sm-3"><span>活动发起人：</span></dt>
				<dd class="col-sm-9"><span th:text="${act.tbStu.name}"></span></dd>
			</dl>

			<dl class="row">
				<dt class="col-sm-3"><span>报名人数：</span></dt>
				<dd class="col-sm-9"><span th:text="${act.acCount}+'人'"></span></dd>
			</dl>

			<dl class="row">
				<dt class="col-sm-3"><span>开始时间：</span></dt>
				<dd class="col-sm-9"><span th:text="${#temporals.format(act.acStartTime,'yyyy-MM-dd HH:mm')}"></span></dd>
			</dl>
		</div>
		<div class="col-lg-2">
			<button class="btn btn-success btn-w-md" type="button" th:onclick="'javascript:addStuToAct('+${act.acId}+')' ">报名参加活动</button>
		</div>
	</div>
</div>
<script type="text/javascript" src="/js/axios.min.js"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">

    function addStuToAct(acId) {
        axios.get('/act/addStuToAct?acId='+acId)
            .then(function (response) {
                var data=response.data;
                if(data==1){
                    alert("报名成功，请等待官方审核通过");
                }else if(data==2){
                    alert("你已报名该活动")
                }else if(data==3){
                    alert("报名人数已满")
				}
            }).catch(function (error) {
            alert("报名失败，请审核你的信息是否有误")
        })
    }

</script>

</body>
</html>